{{Extend "layout"}}
{{Block "title"}}{{"标签管理"|T}}{{/Block}}
{{Block "breadcrumb"}}
{{Super}}
<li class="active">{{"标签管理"|T}}</li>
{{/Block}}
{{Block "main"}}
<div class="row">
	<div class="col-md-12">
		<div class="block-flat">
			<div class="header">
				<!-- <a href="__BACKEND__/official/tags_add" class="btn btn-success pull-right">
					<i class="fa fa-plus"></i>
					{{"添加标签"|T}}
				</a> -->
				<h3>{{"标签列表"|T}}</h3>
			</div>
			<div class="content">
				<div class="table-responsive">
				<table class="table no-border hover">
					<thead class="no-border">
						<tr>
							<th><strong>{{"标签"|T}}</strong></th>
							<th><strong>{{"使用次数"|T}}</strong></th>
							<th><strong>{{"分组"|T}}</strong></th>
							<th><strong>{{"显示"|T}}</strong></th>
							<th style="width:120px" class="text-center"><strong>{{"操作"|T}}</strong></th>
						</tr>
					</thead>
					<tbody class="no-border-y">
                        {{range $k,$v := Stored.listData}}
						<tr>
							<td>{{$v.Name}}</td>
							<td>{{$v.Num}}</td>
							<td>{{$v.Group}}</td>
							<td>
								<div class="checkbox checkbox-success no-margin-y">
									<input id="checkbox-{{$k}}" class="styled switch-display" type="checkbox" data-name="{{$v.Name}}" data-display="{{$v.Display}}"{{if eq $v.Display "Y"}} checked="checked"{{end}} value="Y" /><label for="checkbox-{{$k}}">&nbsp;</label>
								</div>
							</td>
							<td class="text-center">
							<a class="label label-success" href="__BACKEND__/official/tags_edit?name={{$v.Name}}" title="{{"编辑"|T}}" data-toggle="tooltip"><i class="fa fa-pencil"></i></a> 
							<a class="label label-danger" href="__BACKEND__/official/tags_delete?name={{$v.Name}}" onclick="return confirm('{{"真的要删除吗？"|T}}');" title="{{"删除"|T}}" data-toggle="tooltip"><i class="fa fa-times"></i></a>
							</td>
						</tr>
                        {{end}}
					</tbody>
				</table>		
				</div>
				{{Stored.pagination.Render}}
			</div>
		</div>				
	</div>
</div>
{{/Block}}
{{Block "footer"}}
<script>
$(function(){
	$('input.switch-display').on('click',function(r){
		var that=$(this),display=that.data('display')=='Y'?'N':'Y';
		$.get(BACKEND_URL+'/official/tags_edit',{
			display:display,
			name:that.data('name')
		},function(r){
			if(r.Code==1){
				that.data('display',display);
				that.prop('checked',display=='Y');
			}
			App.message({title:'{{"系统消息"|T}}',text:r.Info,time:5000,sticky:false,class_name:r.Code==1?'success':'error'});
		},'json');
	});
});
</script>
{{/Block}}